package com.whl.sm.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.whl.sm.model.repair.RepairApply;
import com.whl.sm.model.repair.RepairTask;
import com.whl.sm.model.system.OrgUserInfo;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;
import java.util.Objects;

@Data
@NoArgsConstructor
public class RepairTaskIInfoVo {

    public RepairTaskIInfoVo(RepairTask repairTask, RepairApply repairApply, OrgUserInfo staff,OrgUserInfo operator){
        if (Objects.nonNull(repairTask)){
            setId(repairTask.getId());
            setRepairFeedback(repairTask.getRepairFeedback());
            setCompleteTime(repairTask.getCompleteTime());
            setCreateTime(repairTask.getCreateTime());
            setUpdateTime(repairTask.getUpdateTime());
        }
        if (Objects.nonNull(repairApply)){
            setLinkApplyId(repairApply.getId());
            setStep(repairApply.getStep());
            setRepairStatus(repairApply.getRepairStatus());
            setRepairLocation(repairApply.getRepairLocation());
        }
        if (Objects.nonNull(staff)){
            setStaffId(staff.getUserId());
            setStaffTel(staff.getLinkTel());
            setStaffName(staff.getUserName());
        }
        if (Objects.nonNull(operator)){
            setOperator(operator.getId());
            setOperatorName(operator.getUserName());
        }
    }

    private String id;
    /**
     * 关联数据id
     */
    private String linkApplyId;

    /**
     * 维修地点
     */
    private String repairLocation;


    /**
     * 维修人员id
     */
    private String staffId;


    /**
     * 维修人员名称
     */
    private String staffName;

    /**
     * 报修单状态值
     */
    private Integer step;

    /**
     * 报修单状态
     */
    private String repairStatus;

    /**
     * 维修人员联系电话
     */
    private String staffTel;

    /**
     * 维修人员反馈
     */
    private String repairFeedback;

    /**
     * 创建时间
     */
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date createTime;

    /**
     * 更新时间
     */
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date updateTime;

    /**
     * 完成时间
     */
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date completeTime;

    /**
     * 操作者
     */
    private String operator;

    /**
     * 操作者名称
     */
    private String operatorName;

}
